// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Agents;
/// let client = Agents::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Agents][google.cloud.dialogflow.cx.v3.Agent].
///
/// [google.cloud.dialogflow.cx.v3.Agent]: crate::model::Agent
///
/// # Configuration
///
/// To configure `Agents` use the `with_*` methods in the type returned
/// by [builder()][Agents::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::agents::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::agents::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Agents` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Agents` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "agents")]
#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
#[derive(Clone, Debug)]
pub struct Agents {
    inner: std::sync::Arc<dyn super::stub::dynamic::Agents>,
}

#[cfg(feature = "agents")]
impl Agents {
    /// Returns a builder for [Agents].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Agents;
    /// let client = Agents::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::agents::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::agents::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Agents + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Agents>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Agents> {
        super::transport::Agents::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Agents> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Agents::new)
    }

    /// Returns the list of all agents in the specified location.
    pub fn list_agents(&self) -> super::builder::agents::ListAgents {
        super::builder::agents::ListAgents::new(self.inner.clone())
    }

    /// Retrieves the specified agent.
    pub fn get_agent(&self) -> super::builder::agents::GetAgent {
        super::builder::agents::GetAgent::new(self.inner.clone())
    }

    /// Creates an agent in the specified location.
    ///
    /// Note: You should always train flows prior to sending them queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn create_agent(&self) -> super::builder::agents::CreateAgent {
        super::builder::agents::CreateAgent::new(self.inner.clone())
    }

    /// Updates the specified agent.
    ///
    /// Note: You should always train flows prior to sending them queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn update_agent(&self) -> super::builder::agents::UpdateAgent {
        super::builder::agents::UpdateAgent::new(self.inner.clone())
    }

    /// Deletes the specified agent.
    pub fn delete_agent(&self) -> super::builder::agents::DeleteAgent {
        super::builder::agents::DeleteAgent::new(self.inner.clone())
    }

    /// Exports the specified agent to a binary file.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`:
    ///   [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ExportAgentResponse]: crate::model::ExportAgentResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_agent(&self) -> super::builder::agents::ExportAgent {
        super::builder::agents::ExportAgent::new(self.inner.clone())
    }

    /// Restores the specified agent from a binary file.
    ///
    /// Replaces the current agent with a new one. Note that all existing resources
    /// in agent (e.g. intents, entity types, flows) will be removed.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train flows prior to sending them queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn restore_agent(&self) -> super::builder::agents::RestoreAgent {
        super::builder::agents::RestoreAgent::new(self.inner.clone())
    }

    /// Validates the specified agent and creates or updates validation results.
    /// The agent in draft version is validated. Please call this API after the
    /// training is completed to get the complete validation results.
    pub fn validate_agent(&self) -> super::builder::agents::ValidateAgent {
        super::builder::agents::ValidateAgent::new(self.inner.clone())
    }

    /// Gets the latest agent validation result. Agent validation is performed
    /// when ValidateAgent is called.
    pub fn get_agent_validation_result(&self) -> super::builder::agents::GetAgentValidationResult {
        super::builder::agents::GetAgentValidationResult::new(self.inner.clone())
    }

    /// Gets the generative settings for the agent.
    pub fn get_generative_settings(&self) -> super::builder::agents::GetGenerativeSettings {
        super::builder::agents::GetGenerativeSettings::new(self.inner.clone())
    }

    /// Updates the generative settings for the agent.
    pub fn update_generative_settings(&self) -> super::builder::agents::UpdateGenerativeSettings {
        super::builder::agents::UpdateGenerativeSettings::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::agents::ListLocations {
        super::builder::agents::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::agents::GetLocation {
        super::builder::agents::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::agents::ListOperations {
        super::builder::agents::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::agents::GetOperation {
        super::builder::agents::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::agents::CancelOperation {
        super::builder::agents::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Changelogs;
/// let client = Changelogs::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Changelogs][google.cloud.dialogflow.cx.v3.Changelog].
///
/// [google.cloud.dialogflow.cx.v3.Changelog]: crate::model::Changelog
///
/// # Configuration
///
/// To configure `Changelogs` use the `with_*` methods in the type returned
/// by [builder()][Changelogs::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::changelogs::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::changelogs::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Changelogs` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Changelogs` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "changelogs")]
#[cfg_attr(docsrs, doc(cfg(feature = "changelogs")))]
#[derive(Clone, Debug)]
pub struct Changelogs {
    inner: std::sync::Arc<dyn super::stub::dynamic::Changelogs>,
}

#[cfg(feature = "changelogs")]
impl Changelogs {
    /// Returns a builder for [Changelogs].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Changelogs;
    /// let client = Changelogs::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::changelogs::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::changelogs::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Changelogs + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Changelogs>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Changelogs> {
        super::transport::Changelogs::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Changelogs> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Changelogs::new)
    }

    /// Returns the list of Changelogs.
    pub fn list_changelogs(&self) -> super::builder::changelogs::ListChangelogs {
        super::builder::changelogs::ListChangelogs::new(self.inner.clone())
    }

    /// Retrieves the specified Changelog.
    pub fn get_changelog(&self) -> super::builder::changelogs::GetChangelog {
        super::builder::changelogs::GetChangelog::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::changelogs::ListLocations {
        super::builder::changelogs::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::changelogs::GetLocation {
        super::builder::changelogs::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::changelogs::ListOperations {
        super::builder::changelogs::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::changelogs::GetOperation {
        super::builder::changelogs::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::changelogs::CancelOperation {
        super::builder::changelogs::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Deployments;
/// let client = Deployments::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Deployments][google.cloud.dialogflow.cx.v3.Deployment].
///
/// [google.cloud.dialogflow.cx.v3.Deployment]: crate::model::Deployment
///
/// # Configuration
///
/// To configure `Deployments` use the `with_*` methods in the type returned
/// by [builder()][Deployments::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::deployments::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::deployments::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Deployments` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Deployments` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "deployments")]
#[cfg_attr(docsrs, doc(cfg(feature = "deployments")))]
#[derive(Clone, Debug)]
pub struct Deployments {
    inner: std::sync::Arc<dyn super::stub::dynamic::Deployments>,
}

#[cfg(feature = "deployments")]
impl Deployments {
    /// Returns a builder for [Deployments].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Deployments;
    /// let client = Deployments::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::deployments::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::deployments::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Deployments + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Deployments>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Deployments> {
        super::transport::Deployments::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Deployments> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Deployments::new)
    }

    /// Returns the list of all deployments in the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    pub fn list_deployments(&self) -> super::builder::deployments::ListDeployments {
        super::builder::deployments::ListDeployments::new(self.inner.clone())
    }

    /// Retrieves the specified
    /// [Deployment][google.cloud.dialogflow.cx.v3.Deployment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Deployment]: crate::model::Deployment
    pub fn get_deployment(&self) -> super::builder::deployments::GetDeployment {
        super::builder::deployments::GetDeployment::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::deployments::ListLocations {
        super::builder::deployments::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::deployments::GetLocation {
        super::builder::deployments::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::deployments::ListOperations {
        super::builder::deployments::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::deployments::GetOperation {
        super::builder::deployments::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::deployments::CancelOperation {
        super::builder::deployments::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::EntityTypes;
/// let client = EntityTypes::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [EntityTypes][google.cloud.dialogflow.cx.v3.EntityType].
///
/// [google.cloud.dialogflow.cx.v3.EntityType]: crate::model::EntityType
///
/// # Configuration
///
/// To configure `EntityTypes` use the `with_*` methods in the type returned
/// by [builder()][EntityTypes::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::entity_types::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::entity_types::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `EntityTypes` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `EntityTypes` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "entity-types")]
#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
#[derive(Clone, Debug)]
pub struct EntityTypes {
    inner: std::sync::Arc<dyn super::stub::dynamic::EntityTypes>,
}

#[cfg(feature = "entity-types")]
impl EntityTypes {
    /// Returns a builder for [EntityTypes].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::EntityTypes;
    /// let client = EntityTypes::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::entity_types::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::entity_types::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::EntityTypes + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EntityTypes>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EntityTypes> {
        super::transport::EntityTypes::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::EntityTypes> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::EntityTypes::new)
    }

    /// Retrieves the specified entity type.
    pub fn get_entity_type(&self) -> super::builder::entity_types::GetEntityType {
        super::builder::entity_types::GetEntityType::new(self.inner.clone())
    }

    /// Creates an entity type in the specified agent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn create_entity_type(&self) -> super::builder::entity_types::CreateEntityType {
        super::builder::entity_types::CreateEntityType::new(self.inner.clone())
    }

    /// Updates the specified entity type.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn update_entity_type(&self) -> super::builder::entity_types::UpdateEntityType {
        super::builder::entity_types::UpdateEntityType::new(self.inner.clone())
    }

    /// Deletes the specified entity type.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn delete_entity_type(&self) -> super::builder::entity_types::DeleteEntityType {
        super::builder::entity_types::DeleteEntityType::new(self.inner.clone())
    }

    /// Returns the list of all entity types in the specified agent.
    pub fn list_entity_types(&self) -> super::builder::entity_types::ListEntityTypes {
        super::builder::entity_types::ListEntityTypes::new(self.inner.clone())
    }

    /// Exports the selected entity types.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_entity_types(&self) -> super::builder::entity_types::ExportEntityTypes {
        super::builder::entity_types::ExportEntityTypes::new(self.inner.clone())
    }

    /// Imports the specified entitytypes into the agent.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_entity_types(&self) -> super::builder::entity_types::ImportEntityTypes {
        super::builder::entity_types::ImportEntityTypes::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::entity_types::ListLocations {
        super::builder::entity_types::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::entity_types::GetLocation {
        super::builder::entity_types::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::entity_types::ListOperations {
        super::builder::entity_types::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::entity_types::GetOperation {
        super::builder::entity_types::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::entity_types::CancelOperation {
        super::builder::entity_types::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Environments;
/// let client = Environments::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [Environments][google.cloud.dialogflow.cx.v3.Environment].
///
/// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
///
/// # Configuration
///
/// To configure `Environments` use the `with_*` methods in the type returned
/// by [builder()][Environments::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::environments::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::environments::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Environments` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Environments` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "environments")]
#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
#[derive(Clone, Debug)]
pub struct Environments {
    inner: std::sync::Arc<dyn super::stub::dynamic::Environments>,
}

#[cfg(feature = "environments")]
impl Environments {
    /// Returns a builder for [Environments].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Environments;
    /// let client = Environments::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::environments::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::environments::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Environments + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Environments>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Environments> {
        super::transport::Environments::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Environments> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Environments::new)
    }

    /// Returns the list of all environments in the specified
    /// [Agent][google.cloud.dialogflow.cx.v3.Agent].
    ///
    /// [google.cloud.dialogflow.cx.v3.Agent]: crate::model::Agent
    pub fn list_environments(&self) -> super::builder::environments::ListEnvironments {
        super::builder::environments::ListEnvironments::new(self.inner.clone())
    }

    /// Retrieves the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    pub fn get_environment(&self) -> super::builder::environments::GetEnvironment {
        super::builder::environments::GetEnvironment::new(self.inner.clone())
    }

    /// Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the
    /// specified [Agent][google.cloud.dialogflow.cx.v3.Agent].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: [Environment][google.cloud.dialogflow.cx.v3.Environment]
    ///
    /// [google.cloud.dialogflow.cx.v3.Agent]: crate::model::Agent
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_environment(&self) -> super::builder::environments::CreateEnvironment {
        super::builder::environments::CreateEnvironment::new(self.inner.clone())
    }

    /// Updates the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: [Environment][google.cloud.dialogflow.cx.v3.Environment]
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_environment(&self) -> super::builder::environments::UpdateEnvironment {
        super::builder::environments::UpdateEnvironment::new(self.inner.clone())
    }

    /// Deletes the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    pub fn delete_environment(&self) -> super::builder::environments::DeleteEnvironment {
        super::builder::environments::DeleteEnvironment::new(self.inner.clone())
    }

    /// Looks up the history of the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    pub fn lookup_environment_history(
        &self,
    ) -> super::builder::environments::LookupEnvironmentHistory {
        super::builder::environments::LookupEnvironmentHistory::new(self.inner.clone())
    }

    /// Kicks off a continuous test under the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [RunContinuousTestMetadata][google.cloud.dialogflow.cx.v3.RunContinuousTestMetadata]
    /// - `response`:
    ///   [RunContinuousTestResponse][google.cloud.dialogflow.cx.v3.RunContinuousTestResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    /// [google.cloud.dialogflow.cx.v3.RunContinuousTestMetadata]: crate::model::RunContinuousTestMetadata
    /// [google.cloud.dialogflow.cx.v3.RunContinuousTestResponse]: crate::model::RunContinuousTestResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn run_continuous_test(&self) -> super::builder::environments::RunContinuousTest {
        super::builder::environments::RunContinuousTest::new(self.inner.clone())
    }

    /// Fetches a list of continuous test results for a given environment.
    pub fn list_continuous_test_results(
        &self,
    ) -> super::builder::environments::ListContinuousTestResults {
        super::builder::environments::ListContinuousTestResults::new(self.inner.clone())
    }

    /// Deploys a flow to the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [DeployFlowMetadata][google.cloud.dialogflow.cx.v3.DeployFlowMetadata]
    /// - `response`:
    ///   [DeployFlowResponse][google.cloud.dialogflow.cx.v3.DeployFlowResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.DeployFlowMetadata]: crate::model::DeployFlowMetadata
    /// [google.cloud.dialogflow.cx.v3.DeployFlowResponse]: crate::model::DeployFlowResponse
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn deploy_flow(&self) -> super::builder::environments::DeployFlow {
        super::builder::environments::DeployFlow::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::environments::ListLocations {
        super::builder::environments::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::environments::GetLocation {
        super::builder::environments::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::environments::ListOperations {
        super::builder::environments::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::environments::GetOperation {
        super::builder::environments::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::environments::CancelOperation {
        super::builder::environments::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Experiments;
/// let client = Experiments::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Experiments][google.cloud.dialogflow.cx.v3.Experiment].
///
/// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
///
/// # Configuration
///
/// To configure `Experiments` use the `with_*` methods in the type returned
/// by [builder()][Experiments::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::experiments::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::experiments::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Experiments` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Experiments` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "experiments")]
#[cfg_attr(docsrs, doc(cfg(feature = "experiments")))]
#[derive(Clone, Debug)]
pub struct Experiments {
    inner: std::sync::Arc<dyn super::stub::dynamic::Experiments>,
}

#[cfg(feature = "experiments")]
impl Experiments {
    /// Returns a builder for [Experiments].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Experiments;
    /// let client = Experiments::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::experiments::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::experiments::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Experiments + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Experiments>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Experiments> {
        super::transport::Experiments::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Experiments> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Experiments::new)
    }

    /// Returns the list of all experiments in the specified
    /// [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    pub fn list_experiments(&self) -> super::builder::experiments::ListExperiments {
        super::builder::experiments::ListExperiments::new(self.inner.clone())
    }

    /// Retrieves the specified
    /// [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
    pub fn get_experiment(&self) -> super::builder::experiments::GetExperiment {
        super::builder::experiments::GetExperiment::new(self.inner.clone())
    }

    /// Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the
    /// specified [Environment][google.cloud.dialogflow.cx.v3.Environment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Environment]: crate::model::Environment
    /// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
    pub fn create_experiment(&self) -> super::builder::experiments::CreateExperiment {
        super::builder::experiments::CreateExperiment::new(self.inner.clone())
    }

    /// Updates the specified
    /// [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
    pub fn update_experiment(&self) -> super::builder::experiments::UpdateExperiment {
        super::builder::experiments::UpdateExperiment::new(self.inner.clone())
    }

    /// Deletes the specified
    /// [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
    ///
    /// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
    pub fn delete_experiment(&self) -> super::builder::experiments::DeleteExperiment {
        super::builder::experiments::DeleteExperiment::new(self.inner.clone())
    }

    /// Starts the specified
    /// [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only
    /// changes the state of experiment from PENDING to RUNNING.
    ///
    /// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
    pub fn start_experiment(&self) -> super::builder::experiments::StartExperiment {
        super::builder::experiments::StartExperiment::new(self.inner.clone())
    }

    /// Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment].
    /// This rpc only changes the state of experiment from RUNNING to DONE.
    ///
    /// [google.cloud.dialogflow.cx.v3.Experiment]: crate::model::Experiment
    pub fn stop_experiment(&self) -> super::builder::experiments::StopExperiment {
        super::builder::experiments::StopExperiment::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::experiments::ListLocations {
        super::builder::experiments::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::experiments::GetLocation {
        super::builder::experiments::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::experiments::ListOperations {
        super::builder::experiments::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::experiments::GetOperation {
        super::builder::experiments::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::experiments::CancelOperation {
        super::builder::experiments::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Flows;
/// let client = Flows::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Flows][google.cloud.dialogflow.cx.v3.Flow].
///
/// [google.cloud.dialogflow.cx.v3.Flow]: crate::model::Flow
///
/// # Configuration
///
/// To configure `Flows` use the `with_*` methods in the type returned
/// by [builder()][Flows::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::flows::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::flows::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Flows` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Flows` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "flows")]
#[cfg_attr(docsrs, doc(cfg(feature = "flows")))]
#[derive(Clone, Debug)]
pub struct Flows {
    inner: std::sync::Arc<dyn super::stub::dynamic::Flows>,
}

#[cfg(feature = "flows")]
impl Flows {
    /// Returns a builder for [Flows].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Flows;
    /// let client = Flows::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::flows::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::flows::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Flows + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Flows>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Flows> {
        super::transport::Flows::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Flows> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Flows::new)
    }

    /// Creates a flow in the specified agent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn create_flow(&self) -> super::builder::flows::CreateFlow {
        super::builder::flows::CreateFlow::new(self.inner.clone())
    }

    /// Deletes a specified flow.
    pub fn delete_flow(&self) -> super::builder::flows::DeleteFlow {
        super::builder::flows::DeleteFlow::new(self.inner.clone())
    }

    /// Returns the list of all flows in the specified agent.
    pub fn list_flows(&self) -> super::builder::flows::ListFlows {
        super::builder::flows::ListFlows::new(self.inner.clone())
    }

    /// Retrieves the specified flow.
    pub fn get_flow(&self) -> super::builder::flows::GetFlow {
        super::builder::flows::GetFlow::new(self.inner.clone())
    }

    /// Updates the specified flow.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn update_flow(&self) -> super::builder::flows::UpdateFlow {
        super::builder::flows::UpdateFlow::new(self.inner.clone())
    }

    /// Trains the specified flow. Note that only the flow in 'draft' environment
    /// is trained.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn train_flow(&self) -> super::builder::flows::TrainFlow {
        super::builder::flows::TrainFlow::new(self.inner.clone())
    }

    /// Validates the specified flow and creates or updates validation results.
    /// Please call this API after the training is completed to get the complete
    /// validation results.
    pub fn validate_flow(&self) -> super::builder::flows::ValidateFlow {
        super::builder::flows::ValidateFlow::new(self.inner.clone())
    }

    /// Gets the latest flow validation result. Flow validation is performed
    /// when ValidateFlow is called.
    pub fn get_flow_validation_result(&self) -> super::builder::flows::GetFlowValidationResult {
        super::builder::flows::GetFlowValidationResult::new(self.inner.clone())
    }

    /// Imports the specified flow to the specified agent from a binary file.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`:
    ///   [ImportFlowResponse][google.cloud.dialogflow.cx.v3.ImportFlowResponse]
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// [google.cloud.dialogflow.cx.v3.ImportFlowResponse]: crate::model::ImportFlowResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_flow(&self) -> super::builder::flows::ImportFlow {
        super::builder::flows::ImportFlow::new(self.inner.clone())
    }

    /// Exports the specified flow to a binary file.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`:
    ///   [ExportFlowResponse][google.cloud.dialogflow.cx.v3.ExportFlowResponse]
    ///
    /// Note that resources (e.g. intents, entities, webhooks) that the flow
    /// references will also be exported.
    ///
    /// [google.cloud.dialogflow.cx.v3.ExportFlowResponse]: crate::model::ExportFlowResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_flow(&self) -> super::builder::flows::ExportFlow {
        super::builder::flows::ExportFlow::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::flows::ListLocations {
        super::builder::flows::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::flows::GetLocation {
        super::builder::flows::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::flows::ListOperations {
        super::builder::flows::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::flows::GetOperation {
        super::builder::flows::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::flows::CancelOperation {
        super::builder::flows::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Generators;
/// let client = Generators::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Generators][google.cloud.dialogflow.cx.v3.Generator]
///
/// [google.cloud.dialogflow.cx.v3.Generator]: crate::model::Generator
///
/// # Configuration
///
/// To configure `Generators` use the `with_*` methods in the type returned
/// by [builder()][Generators::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::generators::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::generators::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Generators` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Generators` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "generators")]
#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
#[derive(Clone, Debug)]
pub struct Generators {
    inner: std::sync::Arc<dyn super::stub::dynamic::Generators>,
}

#[cfg(feature = "generators")]
impl Generators {
    /// Returns a builder for [Generators].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Generators;
    /// let client = Generators::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::generators::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::generators::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Generators + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Generators>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Generators> {
        super::transport::Generators::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Generators> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Generators::new)
    }

    /// Returns the list of all generators in the specified agent.
    pub fn list_generators(&self) -> super::builder::generators::ListGenerators {
        super::builder::generators::ListGenerators::new(self.inner.clone())
    }

    /// Retrieves the specified generator.
    pub fn get_generator(&self) -> super::builder::generators::GetGenerator {
        super::builder::generators::GetGenerator::new(self.inner.clone())
    }

    /// Creates a generator in the specified agent.
    pub fn create_generator(&self) -> super::builder::generators::CreateGenerator {
        super::builder::generators::CreateGenerator::new(self.inner.clone())
    }

    /// Update the specified generator.
    pub fn update_generator(&self) -> super::builder::generators::UpdateGenerator {
        super::builder::generators::UpdateGenerator::new(self.inner.clone())
    }

    /// Deletes the specified generators.
    pub fn delete_generator(&self) -> super::builder::generators::DeleteGenerator {
        super::builder::generators::DeleteGenerator::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::generators::ListLocations {
        super::builder::generators::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::generators::GetLocation {
        super::builder::generators::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::generators::ListOperations {
        super::builder::generators::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::generators::GetOperation {
        super::builder::generators::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::generators::CancelOperation {
        super::builder::generators::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Intents;
/// let client = Intents::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent].
///
/// [google.cloud.dialogflow.cx.v3.Intent]: crate::model::Intent
///
/// # Configuration
///
/// To configure `Intents` use the `with_*` methods in the type returned
/// by [builder()][Intents::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::intents::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::intents::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Intents` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Intents` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "intents")]
#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
#[derive(Clone, Debug)]
pub struct Intents {
    inner: std::sync::Arc<dyn super::stub::dynamic::Intents>,
}

#[cfg(feature = "intents")]
impl Intents {
    /// Returns a builder for [Intents].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Intents;
    /// let client = Intents::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::intents::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::intents::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Intents + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Intents>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Intents> {
        super::transport::Intents::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Intents> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Intents::new)
    }

    /// Returns the list of all intents in the specified agent.
    pub fn list_intents(&self) -> super::builder::intents::ListIntents {
        super::builder::intents::ListIntents::new(self.inner.clone())
    }

    /// Retrieves the specified intent.
    pub fn get_intent(&self) -> super::builder::intents::GetIntent {
        super::builder::intents::GetIntent::new(self.inner.clone())
    }

    /// Creates an intent in the specified agent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn create_intent(&self) -> super::builder::intents::CreateIntent {
        super::builder::intents::CreateIntent::new(self.inner.clone())
    }

    /// Updates the specified intent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn update_intent(&self) -> super::builder::intents::UpdateIntent {
        super::builder::intents::UpdateIntent::new(self.inner.clone())
    }

    /// Deletes the specified intent.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn delete_intent(&self) -> super::builder::intents::DeleteIntent {
        super::builder::intents::DeleteIntent::new(self.inner.clone())
    }

    /// Imports the specified intents into the agent.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3.ImportIntentsMetadata]
    /// - `response`:
    ///   [ImportIntentsResponse][google.cloud.dialogflow.cx.v3.ImportIntentsResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ImportIntentsMetadata]: crate::model::ImportIntentsMetadata
    /// [google.cloud.dialogflow.cx.v3.ImportIntentsResponse]: crate::model::ImportIntentsResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_intents(&self) -> super::builder::intents::ImportIntents {
        super::builder::intents::ImportIntents::new(self.inner.clone())
    }

    /// Exports the selected intents.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3.ExportIntentsMetadata]
    /// - `response`:
    ///   [ExportIntentsResponse][google.cloud.dialogflow.cx.v3.ExportIntentsResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ExportIntentsMetadata]: crate::model::ExportIntentsMetadata
    /// [google.cloud.dialogflow.cx.v3.ExportIntentsResponse]: crate::model::ExportIntentsResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_intents(&self) -> super::builder::intents::ExportIntents {
        super::builder::intents::ExportIntents::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::intents::ListLocations {
        super::builder::intents::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::intents::GetLocation {
        super::builder::intents::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::intents::ListOperations {
        super::builder::intents::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::intents::GetOperation {
        super::builder::intents::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::intents::CancelOperation {
        super::builder::intents::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Pages;
/// let client = Pages::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Pages][google.cloud.dialogflow.cx.v3.Page].
///
/// [google.cloud.dialogflow.cx.v3.Page]: crate::model::Page
///
/// # Configuration
///
/// To configure `Pages` use the `with_*` methods in the type returned
/// by [builder()][Pages::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::pages::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::pages::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Pages` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Pages` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "pages")]
#[cfg_attr(docsrs, doc(cfg(feature = "pages")))]
#[derive(Clone, Debug)]
pub struct Pages {
    inner: std::sync::Arc<dyn super::stub::dynamic::Pages>,
}

#[cfg(feature = "pages")]
impl Pages {
    /// Returns a builder for [Pages].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Pages;
    /// let client = Pages::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::pages::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::pages::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Pages + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Pages>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Pages> {
        super::transport::Pages::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Pages> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Pages::new)
    }

    /// Returns the list of all pages in the specified flow.
    pub fn list_pages(&self) -> super::builder::pages::ListPages {
        super::builder::pages::ListPages::new(self.inner.clone())
    }

    /// Retrieves the specified page.
    pub fn get_page(&self) -> super::builder::pages::GetPage {
        super::builder::pages::GetPage::new(self.inner.clone())
    }

    /// Creates a page in the specified flow.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn create_page(&self) -> super::builder::pages::CreatePage {
        super::builder::pages::CreatePage::new(self.inner.clone())
    }

    /// Updates the specified page.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn update_page(&self) -> super::builder::pages::UpdatePage {
        super::builder::pages::UpdatePage::new(self.inner.clone())
    }

    /// Deletes the specified page.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    pub fn delete_page(&self) -> super::builder::pages::DeletePage {
        super::builder::pages::DeletePage::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::pages::ListLocations {
        super::builder::pages::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::pages::GetLocation {
        super::builder::pages::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::pages::ListOperations {
        super::builder::pages::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::pages::GetOperation {
        super::builder::pages::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::pages::CancelOperation {
        super::builder::pages::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::SecuritySettingsService;
/// let client = SecuritySettingsService::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing security settings for Dialogflow.
///
/// # Configuration
///
/// To configure `SecuritySettingsService` use the `with_*` methods in the type returned
/// by [builder()][SecuritySettingsService::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::security_settings_service::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::security_settings_service::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `SecuritySettingsService` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `SecuritySettingsService` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "security-settings-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "security-settings-service")))]
#[derive(Clone, Debug)]
pub struct SecuritySettingsService {
    inner: std::sync::Arc<dyn super::stub::dynamic::SecuritySettingsService>,
}

#[cfg(feature = "security-settings-service")]
impl SecuritySettingsService {
    /// Returns a builder for [SecuritySettingsService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::SecuritySettingsService;
    /// let client = SecuritySettingsService::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::security_settings_service::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::security_settings_service::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::SecuritySettingsService + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<
        std::sync::Arc<dyn super::stub::dynamic::SecuritySettingsService>,
    > {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SecuritySettingsService> {
        super::transport::SecuritySettingsService::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SecuritySettingsService> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::SecuritySettingsService::new)
    }

    /// Create security settings in the specified location.
    pub fn create_security_settings(
        &self,
    ) -> super::builder::security_settings_service::CreateSecuritySettings {
        super::builder::security_settings_service::CreateSecuritySettings::new(self.inner.clone())
    }

    /// Retrieves the specified
    /// [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The
    /// returned settings may be stale by up to 1 minute.
    ///
    /// [google.cloud.dialogflow.cx.v3.SecuritySettings]: crate::model::SecuritySettings
    pub fn get_security_settings(
        &self,
    ) -> super::builder::security_settings_service::GetSecuritySettings {
        super::builder::security_settings_service::GetSecuritySettings::new(self.inner.clone())
    }

    /// Updates the specified
    /// [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
    ///
    /// [google.cloud.dialogflow.cx.v3.SecuritySettings]: crate::model::SecuritySettings
    pub fn update_security_settings(
        &self,
    ) -> super::builder::security_settings_service::UpdateSecuritySettings {
        super::builder::security_settings_service::UpdateSecuritySettings::new(self.inner.clone())
    }

    /// Returns the list of all security settings in the specified location.
    pub fn list_security_settings(
        &self,
    ) -> super::builder::security_settings_service::ListSecuritySettings {
        super::builder::security_settings_service::ListSecuritySettings::new(self.inner.clone())
    }

    /// Deletes the specified
    /// [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings].
    ///
    /// [google.cloud.dialogflow.cx.v3.SecuritySettings]: crate::model::SecuritySettings
    pub fn delete_security_settings(
        &self,
    ) -> super::builder::security_settings_service::DeleteSecuritySettings {
        super::builder::security_settings_service::DeleteSecuritySettings::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::security_settings_service::ListLocations {
        super::builder::security_settings_service::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::security_settings_service::GetLocation {
        super::builder::security_settings_service::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::security_settings_service::ListOperations {
        super::builder::security_settings_service::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::security_settings_service::GetOperation {
        super::builder::security_settings_service::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::security_settings_service::CancelOperation {
        super::builder::security_settings_service::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Sessions;
/// let client = Sessions::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// A session represents an interaction with a user. You retrieve user input
/// and pass it to the
/// [DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] method to
/// determine user intent and respond.
///
/// [google.cloud.dialogflow.cx.v3.Sessions.DetectIntent]: crate::client::Sessions::detect_intent
///
/// # Configuration
///
/// To configure `Sessions` use the `with_*` methods in the type returned
/// by [builder()][Sessions::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::sessions::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::sessions::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Sessions` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Sessions` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "sessions")]
#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
#[derive(Clone, Debug)]
pub struct Sessions {
    inner: std::sync::Arc<dyn super::stub::dynamic::Sessions>,
}

#[cfg(feature = "sessions")]
impl Sessions {
    /// Returns a builder for [Sessions].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Sessions;
    /// let client = Sessions::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::sessions::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::sessions::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Sessions + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Sessions>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
        super::transport::Sessions::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Sessions> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Sessions::new)
    }

    /// Processes a natural language query and returns structured, actionable data
    /// as a result. This method is not idempotent, because it may cause session
    /// entity types to be updated, which in turn might affect results of future
    /// queries.
    ///
    /// Note: Always use agent versions for production traffic.
    /// See [Versions and
    /// environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
    pub fn detect_intent(&self) -> super::builder::sessions::DetectIntent {
        super::builder::sessions::DetectIntent::new(self.inner.clone())
    }

    /// Returns preliminary intent match results, doesn't change the session
    /// status.
    pub fn match_intent(&self) -> super::builder::sessions::MatchIntent {
        super::builder::sessions::MatchIntent::new(self.inner.clone())
    }

    /// Fulfills a matched intent returned by
    /// [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]. Must be
    /// called after
    /// [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent], with
    /// input from
    /// [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse].
    /// Otherwise, the behavior is undefined.
    ///
    /// [google.cloud.dialogflow.cx.v3.MatchIntentResponse]: crate::model::MatchIntentResponse
    /// [google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]: crate::client::Sessions::match_intent
    pub fn fulfill_intent(&self) -> super::builder::sessions::FulfillIntent {
        super::builder::sessions::FulfillIntent::new(self.inner.clone())
    }

    /// Updates the feedback received from the user for a single turn of the bot
    /// response.
    pub fn submit_answer_feedback(&self) -> super::builder::sessions::SubmitAnswerFeedback {
        super::builder::sessions::SubmitAnswerFeedback::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::sessions::ListLocations {
        super::builder::sessions::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::sessions::GetLocation {
        super::builder::sessions::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::sessions::ListOperations {
        super::builder::sessions::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::sessions::GetOperation {
        super::builder::sessions::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::sessions::CancelOperation {
        super::builder::sessions::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::SessionEntityTypes;
/// let client = SessionEntityTypes::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [SessionEntityTypes][google.cloud.dialogflow.cx.v3.SessionEntityType].
///
/// [google.cloud.dialogflow.cx.v3.SessionEntityType]: crate::model::SessionEntityType
///
/// # Configuration
///
/// To configure `SessionEntityTypes` use the `with_*` methods in the type returned
/// by [builder()][SessionEntityTypes::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::session_entity_types::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::session_entity_types::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `SessionEntityTypes` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `SessionEntityTypes` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "session-entity-types")]
#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
#[derive(Clone, Debug)]
pub struct SessionEntityTypes {
    inner: std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>,
}

#[cfg(feature = "session-entity-types")]
impl SessionEntityTypes {
    /// Returns a builder for [SessionEntityTypes].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::SessionEntityTypes;
    /// let client = SessionEntityTypes::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::session_entity_types::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::session_entity_types::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::SessionEntityTypes + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SessionEntityTypes>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
        super::transport::SessionEntityTypes::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::SessionEntityTypes> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::SessionEntityTypes::new)
    }

    /// Returns the list of all session entity types in the specified session.
    pub fn list_session_entity_types(
        &self,
    ) -> super::builder::session_entity_types::ListSessionEntityTypes {
        super::builder::session_entity_types::ListSessionEntityTypes::new(self.inner.clone())
    }

    /// Retrieves the specified session entity type.
    pub fn get_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::GetSessionEntityType {
        super::builder::session_entity_types::GetSessionEntityType::new(self.inner.clone())
    }

    /// Creates a session entity type.
    pub fn create_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::CreateSessionEntityType {
        super::builder::session_entity_types::CreateSessionEntityType::new(self.inner.clone())
    }

    /// Updates the specified session entity type.
    pub fn update_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::UpdateSessionEntityType {
        super::builder::session_entity_types::UpdateSessionEntityType::new(self.inner.clone())
    }

    /// Deletes the specified session entity type.
    pub fn delete_session_entity_type(
        &self,
    ) -> super::builder::session_entity_types::DeleteSessionEntityType {
        super::builder::session_entity_types::DeleteSessionEntityType::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::session_entity_types::ListLocations {
        super::builder::session_entity_types::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::session_entity_types::GetLocation {
        super::builder::session_entity_types::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::session_entity_types::ListOperations {
        super::builder::session_entity_types::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::session_entity_types::GetOperation {
        super::builder::session_entity_types::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::session_entity_types::CancelOperation {
        super::builder::session_entity_types::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::TestCases;
/// let client = TestCases::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Test Cases][google.cloud.dialogflow.cx.v3.TestCase] and
/// [Test Case Results][google.cloud.dialogflow.cx.v3.TestCaseResult].
///
/// [google.cloud.dialogflow.cx.v3.TestCase]: crate::model::TestCase
/// [google.cloud.dialogflow.cx.v3.TestCaseResult]: crate::model::TestCaseResult
///
/// # Configuration
///
/// To configure `TestCases` use the `with_*` methods in the type returned
/// by [builder()][TestCases::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::test_cases::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::test_cases::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `TestCases` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `TestCases` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "test-cases")]
#[cfg_attr(docsrs, doc(cfg(feature = "test-cases")))]
#[derive(Clone, Debug)]
pub struct TestCases {
    inner: std::sync::Arc<dyn super::stub::dynamic::TestCases>,
}

#[cfg(feature = "test-cases")]
impl TestCases {
    /// Returns a builder for [TestCases].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::TestCases;
    /// let client = TestCases::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::test_cases::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::test_cases::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::TestCases + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TestCases>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TestCases> {
        super::transport::TestCases::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TestCases> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::TestCases::new)
    }

    /// Fetches a list of test cases for a given agent.
    pub fn list_test_cases(&self) -> super::builder::test_cases::ListTestCases {
        super::builder::test_cases::ListTestCases::new(self.inner.clone())
    }

    /// Batch deletes test cases.
    pub fn batch_delete_test_cases(&self) -> super::builder::test_cases::BatchDeleteTestCases {
        super::builder::test_cases::BatchDeleteTestCases::new(self.inner.clone())
    }

    /// Gets a test case.
    pub fn get_test_case(&self) -> super::builder::test_cases::GetTestCase {
        super::builder::test_cases::GetTestCase::new(self.inner.clone())
    }

    /// Creates a test case for the given agent.
    pub fn create_test_case(&self) -> super::builder::test_cases::CreateTestCase {
        super::builder::test_cases::CreateTestCase::new(self.inner.clone())
    }

    /// Updates the specified test case.
    pub fn update_test_case(&self) -> super::builder::test_cases::UpdateTestCase {
        super::builder::test_cases::UpdateTestCase::new(self.inner.clone())
    }

    /// Kicks off a test case run.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]
    /// - `response`:
    ///   [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.RunTestCaseMetadata]: crate::model::RunTestCaseMetadata
    /// [google.cloud.dialogflow.cx.v3.RunTestCaseResponse]: crate::model::RunTestCaseResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn run_test_case(&self) -> super::builder::test_cases::RunTestCase {
        super::builder::test_cases::RunTestCase::new(self.inner.clone())
    }

    /// Kicks off a batch run of test cases.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [BatchRunTestCasesMetadata][google.cloud.dialogflow.cx.v3.BatchRunTestCasesMetadata]
    /// - `response`:
    ///   [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.BatchRunTestCasesMetadata]: crate::model::BatchRunTestCasesMetadata
    /// [google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse]: crate::model::BatchRunTestCasesResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn batch_run_test_cases(&self) -> super::builder::test_cases::BatchRunTestCases {
        super::builder::test_cases::BatchRunTestCases::new(self.inner.clone())
    }

    /// Calculates the test coverage for an agent.
    pub fn calculate_coverage(&self) -> super::builder::test_cases::CalculateCoverage {
        super::builder::test_cases::CalculateCoverage::new(self.inner.clone())
    }

    /// Imports the test cases from a Cloud Storage bucket or a local file. It
    /// always creates new test cases and won't overwrite any existing ones. The
    /// provided ID in the imported test case is neglected.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [ImportTestCasesMetadata][google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata]
    /// - `response`:
    ///   [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3.ImportTestCasesResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata]: crate::model::ImportTestCasesMetadata
    /// [google.cloud.dialogflow.cx.v3.ImportTestCasesResponse]: crate::model::ImportTestCasesResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn import_test_cases(&self) -> super::builder::test_cases::ImportTestCases {
        super::builder::test_cases::ImportTestCases::new(self.inner.clone())
    }

    /// Exports the test cases under the agent to a Cloud Storage bucket or a local
    /// file. Filter can be applied to export a subset of test cases.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [ExportTestCasesMetadata][google.cloud.dialogflow.cx.v3.ExportTestCasesMetadata]
    /// - `response`:
    ///   [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3.ExportTestCasesResponse]
    ///
    /// [google.cloud.dialogflow.cx.v3.ExportTestCasesMetadata]: crate::model::ExportTestCasesMetadata
    /// [google.cloud.dialogflow.cx.v3.ExportTestCasesResponse]: crate::model::ExportTestCasesResponse
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn export_test_cases(&self) -> super::builder::test_cases::ExportTestCases {
        super::builder::test_cases::ExportTestCases::new(self.inner.clone())
    }

    /// Fetches the list of run results for the given test case. A maximum of 100
    /// results are kept for each test case.
    pub fn list_test_case_results(&self) -> super::builder::test_cases::ListTestCaseResults {
        super::builder::test_cases::ListTestCaseResults::new(self.inner.clone())
    }

    /// Gets a test case result.
    pub fn get_test_case_result(&self) -> super::builder::test_cases::GetTestCaseResult {
        super::builder::test_cases::GetTestCaseResult::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::test_cases::ListLocations {
        super::builder::test_cases::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::test_cases::GetLocation {
        super::builder::test_cases::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::test_cases::ListOperations {
        super::builder::test_cases::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::test_cases::GetOperation {
        super::builder::test_cases::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::test_cases::CancelOperation {
        super::builder::test_cases::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::TransitionRouteGroups;
/// let client = TransitionRouteGroups::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing
/// [TransitionRouteGroups][google.cloud.dialogflow.cx.v3.TransitionRouteGroup].
///
/// [google.cloud.dialogflow.cx.v3.TransitionRouteGroup]: crate::model::TransitionRouteGroup
///
/// # Configuration
///
/// To configure `TransitionRouteGroups` use the `with_*` methods in the type returned
/// by [builder()][TransitionRouteGroups::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::transition_route_groups::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::transition_route_groups::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `TransitionRouteGroups` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `TransitionRouteGroups` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "transition-route-groups")]
#[cfg_attr(docsrs, doc(cfg(feature = "transition-route-groups")))]
#[derive(Clone, Debug)]
pub struct TransitionRouteGroups {
    inner: std::sync::Arc<dyn super::stub::dynamic::TransitionRouteGroups>,
}

#[cfg(feature = "transition-route-groups")]
impl TransitionRouteGroups {
    /// Returns a builder for [TransitionRouteGroups].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::TransitionRouteGroups;
    /// let client = TransitionRouteGroups::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::transition_route_groups::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::transition_route_groups::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::TransitionRouteGroups + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TransitionRouteGroups>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TransitionRouteGroups> {
        super::transport::TransitionRouteGroups::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TransitionRouteGroups> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::TransitionRouteGroups::new)
    }

    /// Returns the list of all transition route groups in the specified flow.
    pub fn list_transition_route_groups(
        &self,
    ) -> super::builder::transition_route_groups::ListTransitionRouteGroups {
        super::builder::transition_route_groups::ListTransitionRouteGroups::new(self.inner.clone())
    }

    /// Retrieves the specified
    /// [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup].
    ///
    /// [google.cloud.dialogflow.cx.v3.TransitionRouteGroup]: crate::model::TransitionRouteGroup
    pub fn get_transition_route_group(
        &self,
    ) -> super::builder::transition_route_groups::GetTransitionRouteGroup {
        super::builder::transition_route_groups::GetTransitionRouteGroup::new(self.inner.clone())
    }

    /// Creates an
    /// [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]
    /// in the specified flow.
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// [google.cloud.dialogflow.cx.v3.TransitionRouteGroup]: crate::model::TransitionRouteGroup
    pub fn create_transition_route_group(
        &self,
    ) -> super::builder::transition_route_groups::CreateTransitionRouteGroup {
        super::builder::transition_route_groups::CreateTransitionRouteGroup::new(self.inner.clone())
    }

    /// Updates the specified
    /// [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup].
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// [google.cloud.dialogflow.cx.v3.TransitionRouteGroup]: crate::model::TransitionRouteGroup
    pub fn update_transition_route_group(
        &self,
    ) -> super::builder::transition_route_groups::UpdateTransitionRouteGroup {
        super::builder::transition_route_groups::UpdateTransitionRouteGroup::new(self.inner.clone())
    }

    /// Deletes the specified
    /// [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup].
    ///
    /// Note: You should always train a flow prior to sending it queries. See the
    /// [training
    /// documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
    ///
    /// [google.cloud.dialogflow.cx.v3.TransitionRouteGroup]: crate::model::TransitionRouteGroup
    pub fn delete_transition_route_group(
        &self,
    ) -> super::builder::transition_route_groups::DeleteTransitionRouteGroup {
        super::builder::transition_route_groups::DeleteTransitionRouteGroup::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::transition_route_groups::ListLocations {
        super::builder::transition_route_groups::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::transition_route_groups::GetLocation {
        super::builder::transition_route_groups::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::transition_route_groups::ListOperations {
        super::builder::transition_route_groups::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::transition_route_groups::GetOperation {
        super::builder::transition_route_groups::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::transition_route_groups::CancelOperation {
        super::builder::transition_route_groups::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Versions;
/// let client = Versions::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Versions][google.cloud.dialogflow.cx.v3.Version].
///
/// [google.cloud.dialogflow.cx.v3.Version]: crate::model::Version
///
/// # Configuration
///
/// To configure `Versions` use the `with_*` methods in the type returned
/// by [builder()][Versions::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::versions::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::versions::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Versions` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Versions` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "versions")]
#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
#[derive(Clone, Debug)]
pub struct Versions {
    inner: std::sync::Arc<dyn super::stub::dynamic::Versions>,
}

#[cfg(feature = "versions")]
impl Versions {
    /// Returns a builder for [Versions].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Versions;
    /// let client = Versions::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::versions::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::versions::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Versions + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Versions>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Versions> {
        super::transport::Versions::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Versions> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Versions::new)
    }

    /// Returns the list of all versions in the specified
    /// [Flow][google.cloud.dialogflow.cx.v3.Flow].
    ///
    /// [google.cloud.dialogflow.cx.v3.Flow]: crate::model::Flow
    pub fn list_versions(&self) -> super::builder::versions::ListVersions {
        super::builder::versions::ListVersions::new(self.inner.clone())
    }

    /// Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version].
    ///
    /// [google.cloud.dialogflow.cx.v3.Version]: crate::model::Version
    pub fn get_version(&self) -> super::builder::versions::GetVersion {
        super::builder::versions::GetVersion::new(self.inner.clone())
    }

    /// Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified
    /// [Flow][google.cloud.dialogflow.cx.v3.Flow].
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`:
    ///   [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata]
    /// - `response`: [Version][google.cloud.dialogflow.cx.v3.Version]
    ///
    /// [google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata]: crate::model::CreateVersionOperationMetadata
    /// [google.cloud.dialogflow.cx.v3.Flow]: crate::model::Flow
    /// [google.cloud.dialogflow.cx.v3.Version]: crate::model::Version
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_version(&self) -> super::builder::versions::CreateVersion {
        super::builder::versions::CreateVersion::new(self.inner.clone())
    }

    /// Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version].
    ///
    /// [google.cloud.dialogflow.cx.v3.Version]: crate::model::Version
    pub fn update_version(&self) -> super::builder::versions::UpdateVersion {
        super::builder::versions::UpdateVersion::new(self.inner.clone())
    }

    /// Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version].
    ///
    /// [google.cloud.dialogflow.cx.v3.Version]: crate::model::Version
    pub fn delete_version(&self) -> super::builder::versions::DeleteVersion {
        super::builder::versions::DeleteVersion::new(self.inner.clone())
    }

    /// Loads resources in the specified version to the draft flow.
    ///
    /// This method is a [long-running
    /// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
    /// The returned `Operation` type has the following method-specific fields:
    ///
    /// - `metadata`: An empty [Struct
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
    /// - `response`: An [Empty
    ///   message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn load_version(&self) -> super::builder::versions::LoadVersion {
        super::builder::versions::LoadVersion::new(self.inner.clone())
    }

    /// Compares the specified base version with target version.
    pub fn compare_versions(&self) -> super::builder::versions::CompareVersions {
        super::builder::versions::CompareVersions::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::versions::ListLocations {
        super::builder::versions::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::versions::GetLocation {
        super::builder::versions::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::versions::ListOperations {
        super::builder::versions::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::versions::GetOperation {
        super::builder::versions::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::versions::CancelOperation {
        super::builder::versions::CancelOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Dialogflow API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_dialogflow_cx_v3::client::Webhooks;
/// let client = Webhooks::builder().build().await?;
/// // use `client` to make requests to the Dialogflow API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Service for managing [Webhooks][google.cloud.dialogflow.cx.v3.Webhook].
///
/// [google.cloud.dialogflow.cx.v3.Webhook]: crate::model::Webhook
///
/// # Configuration
///
/// To configure `Webhooks` use the `with_*` methods in the type returned
/// by [builder()][Webhooks::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://dialogflow.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::webhooks::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::webhooks::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Webhooks` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Webhooks` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[cfg(feature = "webhooks")]
#[cfg_attr(docsrs, doc(cfg(feature = "webhooks")))]
#[derive(Clone, Debug)]
pub struct Webhooks {
    inner: std::sync::Arc<dyn super::stub::dynamic::Webhooks>,
}

#[cfg(feature = "webhooks")]
impl Webhooks {
    /// Returns a builder for [Webhooks].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_dialogflow_cx_v3::client::Webhooks;
    /// let client = Webhooks::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::webhooks::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::webhooks::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Webhooks + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Webhooks>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Webhooks> {
        super::transport::Webhooks::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Webhooks> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Webhooks::new)
    }

    /// Returns the list of all webhooks in the specified agent.
    pub fn list_webhooks(&self) -> super::builder::webhooks::ListWebhooks {
        super::builder::webhooks::ListWebhooks::new(self.inner.clone())
    }

    /// Retrieves the specified webhook.
    pub fn get_webhook(&self) -> super::builder::webhooks::GetWebhook {
        super::builder::webhooks::GetWebhook::new(self.inner.clone())
    }

    /// Creates a webhook in the specified agent.
    pub fn create_webhook(&self) -> super::builder::webhooks::CreateWebhook {
        super::builder::webhooks::CreateWebhook::new(self.inner.clone())
    }

    /// Updates the specified webhook.
    pub fn update_webhook(&self) -> super::builder::webhooks::UpdateWebhook {
        super::builder::webhooks::UpdateWebhook::new(self.inner.clone())
    }

    /// Deletes the specified webhook.
    pub fn delete_webhook(&self) -> super::builder::webhooks::DeleteWebhook {
        super::builder::webhooks::DeleteWebhook::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::webhooks::ListLocations {
        super::builder::webhooks::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::webhooks::GetLocation {
        super::builder::webhooks::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::webhooks::ListOperations {
        super::builder::webhooks::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::webhooks::GetOperation {
        super::builder::webhooks::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::webhooks::CancelOperation {
        super::builder::webhooks::CancelOperation::new(self.inner.clone())
    }
}
